﻿package{
	import wck.BodyShape;
	import flash.geom.ColorTransform;
	
	public class flame extends BodyShape{
		
		public function flame(){
			addFrameScript(totalFrames-1, die);
		}
		public override function shapes():void {
			box();
		}
		public override function create():void {
			applyGravity = true;
			isSensor=true;
			angularVelocity = Math.random()*10 - 5;
			//modifyGravity = -.2; //for now, handled by gravityModWorld
			
			randomYellowToRed();
			super.create();
			
		}
		private function randomYellowToRed():void{
			var tint:ColorTransform = new ColorTransform();
			tint.color = Math.random()*0x00ff00 + 0xff0000;
			tint.blueMultiplier = 0;
			tint.blueOffset = 0;
			this.transform.colorTransform = tint;
		}
		
		private function die(){
			stop();
			addFrameScript(totalFrames-1, null);
			if(parent){
				parent.removeChild(this);
			}
		}
	}
}